# =========== 导入组件 ============
from rest_framework import serializers
# =========== 导入数据类 ============
from taskweb.models import TaskOrder
# ========== 导入任务状态的序列化类 ===========
from basicweb.serializer import TaskStatusSerializer, TaskTypeSerializer, AreaPlaceSerializer
from useweb.serializer import StaffSerializer



# 任务工单
class TaskOrderSerializer(serializers.ModelSerializer):
    taskstatus = TaskStatusSerializer()
    tasktype = TaskTypeSerializer()
    areaplace = AreaPlaceSerializer()
    staff = StaffSerializer()
    create_time = serializers.DateTimeField(format="%Y-%m-%d %H:%M:%S", required=False)
    last_time = serializers.DateTimeField(format="%Y-%m-%d %H:%M:%S", required=False)
    class Meta:
        model = TaskOrder
        fields = "__all__"


